2.2 Base classes

Base classes take in the most common features of the Objects.

* plaque - this class defines the design of the frame of the Objects and the buttons. Menus have there own design and are not affected by plaque. There is basic structure that defines the colors of the plaque:

 struct plaquecolors { COLORS surface , shadow , ltnd; };

Here shadow is the color of the right and the lower edges of the plaque and lthd is the color of the lightened left and upper edges. By default Virtual Panels sets up the next plaque colors:

 const plaquecolors plaquecoldflt = { LIGHTGRAY, DARKGRAY, WHITE };

* display - inherits from the plaque the design of the frame. In addition it holds the size of the screen and performs cls() - clear screen operation. The display class is necessarily inherited by any Object that performs input or output on the screen.

* object - comprises all common properties of Objects that make them behave as a whole. These include title, size, type, status of the Object. All chores of dragging, deleting, redrawing of Objects on the screen, all necessary for this pointers and the memory management, all are in the object class. So any of Objects must inherit this base class.

* tabstop - allows to organize ring of Objects and button groups for panels and dialog boxes. You can move from one tabstop Object or button group to another striking the TAB key on the keyboard or the Shift-TAB if you want to move in reverse order. In Virtual Panels only two classes are derived from tabstop class: butgrp (sect. 3.3) and TSInbox (sect. 4.7). You can add tabstop features to any Object by inheriting tabstop class and defining two virtual functions:

virtual void Activate(void);
virtual void Deactivate(void);

These methods provide procedures for entering to and exiting from the tabstop Object and are called by Virtual Panels core. By writing this methods you define what Object does as a tabstop Object. Below is how these methods look for TSInbox class:

 template <class T>
 void TSInbox<T>::Activate(void)
{
 cls();
 Printf(1,printfmt,*variable); // print the current value of variable
int ch=getch(); cls(); ungetch(ch); // clear it out
 switch ( Scanf(scanfmt,variable) ){
      case  0:
               msg = MSG_PREVTABSTOP;   // Shift-Tab
               goto process;
      case  9:                          // Tab
      case 13:
               msg = MSG_NEXTTABSTOP;   // Enter
               goto process;
      case 27:
               msg = MSG_EXIT;          // ESC
      process: butsystem::SendMessage( msg );
               if ( proc!=NULL ) // process the variable ?
                     *variable = proc( *variable );
               break;
      case -1: beep;            // Format error
      }
}
 virtual void Deactivate(void)
       { Refresh(); } // print the current value of variable